<template>
    <page-body>
        <view class="page">
            <view class="flex align-stretch benben-position-layout flex xzCoupon_flex_0" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
                <view class='flex align-center justify-between flex-sub xzCoupon_fd0_0'>
                    <view class='flex align-center xzCoupon_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back" data-url="1">
                        <text class='fu-iconfont2  xzCoupon_fd0_0_c0_c0'>&#xE794;</text>
                    </view>
                    <text class='xzCoupon_fd0_0_c1'>选择优惠券</text>
                    <view class='flex align-center xzCoupon_fd0_0_c0'>
                    </view>
                </view>

            </view>
            <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
            <!---flex布局flex布局开始-->
			<fu-loading v-if="isShow"></fu-loading>
            <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout xzCoupon_flex_1" v-else>
                <benben-select-diy ref="showSelectPopup1715735464148" class-name='flex flex-direction align-stretch flex' :items.sync="list" v-model="id" 
				    :label.sync="mney" default-type="aid" default-label="money" :allow-cancel='false' type="radio" :disabled='false'>
                    <template v-for='(item,key0) in list'>
                        <view v-if="item.isSelected" class='flex align-center flex xzCoupon_fd1_0_c0' :key="key0" @tap="$refs.showSelectPopup1715735464148.tapHandle(key0)">
                            <image class='xzCoupon_fd1_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"2.png"'></image>
                            <view class='flex flex-wrap align-center flex-sub xzCoupon_fd1_0_c0_c1'>
                                <view class='flex flex-direction flex-wrap align-center xzCoupon_fd1_0_c0_c1_c0'>
                                    <view class='flex flex-wrap align-center'>
                                        <text class='xzCoupon_fd1_0_c0_c1_c0_c0_c0'>￥</text>
                                        <text class='xzCoupon_fd1_0_c0_c1_c0_c0_c1'>{{item.money}}</text>
                                    </view>
                                    <text class='xzCoupon_fd1_0_c0_c1_c0_c1' v-if="item.min_order_money > 0">满{{item.min_order_money}}使用</text>
                                    <text class='xzCoupon_fd1_0_c0_c1_c0_c1' v-else>无门槛</text>
                                </view>
                                <view class='flex flex-direction flex-wrap align-stretch flex-sub xzCoupon_fd1_0_c0_c1_c1'>
                                    <text class='xzCoupon_fd1_0_c0_c1_c1_c0'>{{item.operationcoupon_name}}</text>
                                    <view class='flex flex-wrap align-center'>
                                        <text class='xzCoupon_fd1_0_c0_c1_c1_c1_c0'>有效期至：</text>
                                        <text class='xzCoupon_fd1_0_c0_c1_c1_c1_c0'>{{item.end_time}}</text>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <view v-else class='flex align-center flex xzCoupon_fd1_0_c0' :key="key0" @tap="$refs.showSelectPopup1715735464148.tapHandle(key0)">
                            <image class='xzCoupon_fd1_0_c0_c0' mode="aspectFit" :src='STATIC_URL+"3.png"'></image>
                            <view class='flex flex-wrap align-center flex-sub xzCoupon_fd1_0_c0_c1'>
                                <view class='flex flex-direction flex-wrap align-center xzCoupon_fd1_0_c0_c1_c0'>
                                    <view class='flex flex-wrap align-center'>
                                        <text class='xzCoupon_fd1_0_c0_c1_c0_c0_c0'>￥</text>
                                        <text class='xzCoupon_fd1_0_c0_c1_c0_c0_c1'>{{item.money}}</text>
                                    </view>
                                    <text class='xzCoupon_fd1_0_c0_c1_c0_c1' v-if="item.min_order_money > 0">满{{item.min_order_money}}使用</text>
                                    <text class='xzCoupon_fd1_0_c0_c1_c0_c1' v-else>无门槛</text>
                                </view>
                                <view class='flex flex-direction flex-wrap align-stretch flex-sub xzCoupon_fd1_0_c0_c1_c1'>
                                    <text class='xzCoupon_fd1_0_c0_c1_c1_c0'>{{item.operationcoupon_name}}</text>
                                    <view class='flex flex-wrap align-center'>
                                        <text class='xzCoupon_fd1_0_c0_c1_c1_c1_c0'>有效期至：</text>
                                        <text class='xzCoupon_fd1_0_c0_c1_c1_c1_c0'>{{item.end_time}}</text>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </template>
                </benben-select-diy>
				<view v-if="list.length == 0" class="text-xl text-center text-gray flex flex-direction align-center justify-center"
					style="margin-top: 20%;">
					<image :src='STATIC_URL+"137.png"' mode="widthFix" style="width:400rpx;"></image>
				</view>
				
            </view>

            <!---flex布局flex布局结束-->
            <view class="flex flex-wrap align-start justify-center benben-position-layout flex xzCoupon_flex_2">
                <button class='xzCoupon_fd2_0' @tap.stop="queding">确认</button>

            </view>
            <view :style="{height: '120rpx'}"></view>


        </view>
    </page-body>
</template>
<script>
    import {
        validate
    } from '@/common/utils/validate.js'

    export default {
        components: {},


        data() {
            return {
                "list": [],
                "id": "",
                "aid": "",
                "money": "",
				mney:'',
				isShow:false,
				youhI:'',
				youhP:'',
            };
        },
        computed: {

        },
        watch: {},
        onLoad(options) {
            let {
                aid,
                money,
				youhI,
				youhP
            } = options
            if (aid !== undefined) this.aid = aid
            if (money !== undefined) this.money = money
            if (youhI !== undefined) this.youhI = youhI
            if (youhP !== undefined) this.youhP = youhP
			this.isShow = true
        },
        onUnload() {

        },
        onReady() {

        },
        onShow() {
            this.getbq4a67eff81d29Func()
        },
        onHide() {

        },
        onResize() {

        },
        onPullDownRefresh() {

        },
        onReachBottom(e) {

        },
        onPageScroll(e) {

        },
        methods: {
			queding(){
				if(!this.id){
					this.$message.info('请选择优惠劵');
					return
				}
				let pages = getCurrentPages(); // 当前页页⾯实例
				let nowPage = pages[pages.length -1]; //当前页⾯实例
				let prevPage = pages[pages.length -2]; // 上一页面实例
				prevPage.$vm.youhuiDate(this.id,this.mney) // 调用上一页 定义的方法
				// 返回 上一页
				uni.navigateBack({
				  delta:1 // 可以不写，默认值为 1
				})
			},
            //会员优惠券
            async getbq4a67eff81d29Func() {
                //请求方法
                //数据验证

                let datalist = await this.$api.get(global.apiUrls.post64a67eff81d29, {
                    status: '0',
                    store_id: this.aid,
                    money: this.money
                });

                if (datalist.data.code != 1) {
                    this.$message.info(datalist.data.msg);
                    return
                }
                let infolist = datalist.data;
                this.list = infolist.data
				if(this.youhI){
					this.id = this.youhI
					this.mney = this.youhP
				}
				this.isShow = false

            }
        }
    };
</script>
<style lang="scss" scoped>
    .page {
        width: 100vw;
        overflow-x: hidden;
        min-height: calc(100vh - var(--window-bottom));
        background: #fff;
        background-size: 100% auto;
    }

    .xzCoupon_flex_0 {
        background: #fff;
        width: 750rpx;
        height: 88rpx;
        overflow: hidden;
        z-index: 10;
        top: 0rpx;
        background-size: 100% auto !important;
    }

    .xzCoupon_fd0_0_c1 {
        font-size: 36rpx;
        font-weight: 500;
        color: var(--benbenFontColor0);
    }

    .xzCoupon_fd0_0_c0_c0 {
        font-size: 32rpx;
        font-weight: 500;
        color: #333;
    }

    .xzCoupon_fd0_0_c0 {
        width: 180rpx;
        height: 88rpx;
    }

    .xzCoupon_fd0_0 {
        padding: 0rpx 32rpx 0rpx 32rpx;
        height: 88rpx;
    }

    .xzCoupon_flex_1 {
        padding: 24rpx 24rpx 0rpx 24rpx;
    }

    .xzCoupon_fd1_0_c0_c1_c1_c1_c0 {
        color: #875D23;
        font-size: 23rpx;
        font-weight: 400;
        line-height: 32rpx;
    }

    .xzCoupon_fd1_0_c0_c1_c1_c0 {
        color: #875D23;
        font-size: 32rpx;
        font-weight: 700;
        line-height: 45rpx;
        margin: 0rpx 0rpx 16rpx 0rpx;
    }

    .xzCoupon_fd1_0_c0_c1_c1 {
        margin: 0rpx 20rpx 0rpx 0rpx;
    }

    .xzCoupon_fd1_0_c0_c1_c0_c1 {
        color: #805220;
        font-size: 24rpx;
        font-weight: 500;
        line-height: 33rpx;
    }

    .xzCoupon_fd1_0_c0_c1_c0_c0_c1 {
        color: #875D23;
        font-size: 38rpx;
        font-weight: 800;
        line-height: 78rpx;
        text-align: left;
        font-style: normal;
    }

    .xzCoupon_fd1_0_c0_c1_c0_c0_c0 {
        color: #875D23;
        font-size: 32rpx;
        font-weight: 800;
        line-height: 45rpx;
        text-align: left;
        font-style: normal;
    }

    .xzCoupon_fd1_0_c0_c1_c0 {
        width: 183rpx;
        margin: 0rpx 32rpx 0rpx 0rpx;
    }

    .xzCoupon_fd1_0_c0_c1 {
        background: url(image-path('123.png')) no-repeat;
        padding: 42rpx 0rpx 42rpx 0rpx;
        background-size: 100% 100%;
    }

    .xzCoupon_fd1_0_c0_c0 {
        width: 36rpx;
        height: 36rpx;
        margin: 0rpx 30rpx 0rpx 0rpx;
    }

    .xzCoupon_fd1_0_c0 {
        margin: 0rpx 0rpx 24rpx 0rpx;
    }

    .xzCoupon_flex_2 {
        width: 750rpx;
        height: 120rpx;
        overflow: hidden;
        z-index: 10;
        bottom: calc(0rpx + var(--window-bottom));
    }

    .xzCoupon_fd2_0 {
        background: var(--benbenbgColor0);
        border-radius: 40rpx 40rpx 40rpx 40rpx;
        width: 654rpx;
        line-height: 80rpx;
        font-size: 28rpx;
        color: #fff;
        height: 80rpx;
    }
</style>